package cn.com.cifi.mars.service.impl;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.com.cifi.mars.bean.bo.CoreValueBO;
import cn.com.cifi.mars.bean.bo.PriceCoreDataBO;
import cn.com.cifi.mars.bean.bo.PriceCoreValueBO;
import cn.com.cifi.mars.bean.bo.SysLogBO;
import cn.com.cifi.mars.bean.dto.PriceCoreDetailDTO;
import cn.com.cifi.mars.bean.param.esb.EsbInfoReq;
import cn.com.cifi.mars.bean.param.esb.EsbXgReqParam;
import cn.com.cifi.mars.bean.vo.price.CoreWarnInfoVO;
import cn.com.cifi.mars.bean.vo.price.PriceApproveWarnInfoVO;
import cn.com.cifi.mars.constant.Constants;
import cn.com.cifi.mars.constant.CoreWarnItemEnum;
import cn.com.cifi.mars.constant.IsDeleteEnum;
import cn.com.cifi.mars.constant.IsSuccessEnum;
import cn.com.cifi.mars.constant.LogEventEnum;
import cn.com.cifi.mars.constant.LogSrcEnum;
import cn.com.cifi.mars.constant.LogTypeEnum;
import cn.com.cifi.mars.constant.OrgTypeEunm;
import cn.com.cifi.mars.constant.StageStatusEnum;
import cn.com.cifi.mars.constant.VersionCreateEnum;
import cn.com.cifi.mars.constant.VersionStatusEnum;
import cn.com.cifi.mars.constant.VersionTypeEunm;
import cn.com.cifi.mars.constant.WhetherEnum;
import cn.com.cifi.mars.entity.MdmStage;
import cn.com.cifi.mars.entity.PriceCoreDetail;
import cn.com.cifi.mars.entity.PriceValueOrg;
import cn.com.cifi.mars.entity.PriceValueOrgGroup;
import cn.com.cifi.mars.entity.PriceVersion;
import cn.com.cifi.mars.entity.PriceVersionGroup;
import cn.com.cifi.mars.mapper.mars.ApprovalPreviewMapper;
import cn.com.cifi.mars.mapper.mars.PriceCoreDetailMapper;
import cn.com.cifi.mars.mapper.mars.PriceValueOrgGroupMapper;
import cn.com.cifi.mars.mapper.mars.PriceVersionGroupMapper;
import cn.com.cifi.mars.service.PriceVersionGroupService;
import cn.com.cifi.mars.service.StageService;
import cn.com.cifi.mars.service.SysLogService;
import cn.com.cifi.mars.util.BasicAuthClient;
import cn.com.cifi.mars.util.NumberUtils;
import cn.com.cifi.mars.util.StrUtils;
import cn.com.cifi.mars.util.UUIDUtils;
import cn.com.cifi.mars.util.VersionUtils;
import cn.com.cifi.mars.util.WebUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * <p>
 * 集团审批价格版本表 服务实现类
 * </p>
 *
 * @author yyd
 * @since 2021-07-07
 */
@Slf4j
@Service
public class PriceVersionGroupServiceImpl extends ServiceImpl<PriceVersionGroupMapper, PriceVersionGroup> implements PriceVersionGroupService {

	@Autowired
	StageService stageService;
	@Autowired
	SysLogService sysLogService;
	@Autowired
	PriceVersionGroupMapper priceVersionGroupMapper;
	@Autowired
	PriceValueOrgGroupMapper priceValueOrgGroupMapper;
	@Autowired
	PriceCoreDetailMapper priceCoreDetailMapper;
	@Autowired
    ApprovalPreviewMapper approvalPreviewMapper;
	
	@Value("${xg_query_url}")
    private String xgQueryUrl;
    
    @Value("${api_name}")
	private String apiName;
	
	@Value("${api_key}")
	private String apiKey;
	
	
	@Override
	@Transactional(rollbackFor=Exception.class)
	public void generatePriceVersionGroup(String projectId, String flowId,Integer isPresident) {
		String groupVersionId = UUIDUtils.create();
		List<MdmStage> stageIds = stageService.selectByProjectId(projectId, IsDeleteEnum.NO.getKey());
		for(MdmStage stage : stageIds) {
			if(StrUtils.isNotEmpty(stage.getStatus()) && stage.getStatus().equals(StageStatusEnum.CTIVE.getKey())) {
				PriceVersion priceVersion = priceVersionGroupMapper.selectNewstVersionByStageId(stage.getProjectFid(),IsDeleteEnum.NO.getKey());
				if(priceVersion != null) {
					List<PriceValueOrg> priceDetails = priceVersionGroupMapper.selectVersionDetailByVersionId(priceVersion.getId(),IsDeleteEnum.NO.getKey());
					//创建集团审批版本
					String versionId = preaprePriceVersionGroup(priceVersion,groupVersionId,isPresident,flowId);
					//创建集团审批版本详情
					preaprePriceVersionGroupDetail(versionId,priceDetails);
				}
			}
		}
		//保存核心指标数据
		List<PriceCoreDetail> detailList = new ArrayList<>();
		PriceApproveWarnInfoVO obj = new PriceApproveWarnInfoVO();
		String content = approvalPreviewMapper.selectWarnContentByBillId(flowId);
		if(StrUtils.isNotEmpty(content)) {
			obj = JSON.parseObject(content, PriceApproveWarnInfoVO.class);
			List<CoreWarnInfoVO> coreWarnList = obj.getCoreWarnInfoList();
			for(CoreWarnInfoVO vo : coreWarnList) {
				prepareGxcEquityPrice(projectId,vo,detailList,groupVersionId,flowId,isPresident);
			}
		}
		if(CollectionUtils.isNotEmpty(detailList)) {
			if(isPresident != null && isPresident.intValue() == 1) {
				priceCoreDetailMapper.updateByProjectId(projectId);
			}
			priceCoreDetailMapper.insertBatch(detailList);
		}
		
	}

	@Override
	@Transactional(rollbackFor=Exception.class)
	public void createPriceVersionGroup(String schemeId,String projectId) {
		if(StrUtils.isNotEmpty(schemeId)) {
			String groupVersionId = UUIDUtils.create();
			//查询销管货值审批核心指标数据
			String msg = queryCoreIndicators(schemeId);
			//处理查询到的核心指标数据
			Integer isGroup = handleCoreIndicators(msg,projectId,groupVersionId);
			List<MdmStage> stageIds = stageService.selectByProjectId(projectId, IsDeleteEnum.NO.getKey());
			for(MdmStage stage : stageIds) {
				if(StrUtils.isNotEmpty(stage.getStatus()) && stage.getStatus().equals(StageStatusEnum.CTIVE.getKey())) {
					PriceVersion priceVersion = priceVersionGroupMapper.selectNewstVersionByStageId(stage.getProjectFid(),IsDeleteEnum.NO.getKey());
					if(priceVersion != null) {
						List<PriceValueOrg> priceDetails = priceVersionGroupMapper.selectVersionDetailByVersionId(priceVersion.getId(),IsDeleteEnum.NO.getKey());
						//创建集团审批版本
						String versionId = preaprePriceVersionGroup(priceVersion,groupVersionId,isGroup,schemeId);
						//创建集团审批版本详情
						preaprePriceVersionGroupDetail(versionId,priceDetails);
					}
				}
			}
		}
	}

	private Integer handleCoreIndicators(String msg, String projectId,String groupVersionId) {
		List<PriceCoreDetail> detailList = new ArrayList<>();
		Integer isGroup = null;
		JSONObject resData = JSON.parseObject(msg);
		JSONObject requestInfo = JSONObject.parseObject(resData.getString("resultInfo"));
		if(requestInfo != null) {
			JSONObject data = JSONObject.parseObject(requestInfo.getString("data"));
			if(data != null) {
				String project_id = data.getString("project_id");
				Integer isJt = data.getInteger("isJt");
				String flow_id = data.getString("flow_id");
				String flow_status = data.getString("flow_status");
				//只接收审批通过后的数据
				if(StrUtils.isNotEmpty(flow_status) && flow_status.equals("4")) {
					JSONObject pricingAttached = JSONObject.parseObject(data.getString("pricingAttached"));
					//货值（权益前）
					String czlrlpc_per = pricingAttached.getString("czlrlpc_per");
					String tzbHz = pricingAttached.getString("tzbHz");
					String zgbHz = pricingAttached.getString("zgbHz");
					String ncbHz = pricingAttached.getString("ncbHz");
					String dtjqHz = pricingAttached.getString("dtjqHz");
					String dtjhHz = pricingAttached.getString("dtjhHz");
					prepareXgEquityPrice(CoreWarnItemEnum.EQUITYPRICE.getKey(),project_id,flow_id,isJt,
							czlrlpc_per,tzbHz,zgbHz,ncbHz,dtjqHz,dtjhHz,detailList,groupVersionId);
					
					//权益前创造利润额
					String czlreqyq_czlrlpc_per = pricingAttached.getString("czlreqyq_czlrlpc_per");
					String tzbQyqLre = pricingAttached.getString("tzbQyqLre");
					String zgb_qyq_lre = pricingAttached.getString("zgb_qyq_lre");
					String ncbQyqLre = pricingAttached.getString("ncbQyqLre");
					String dtjqQyqLre = pricingAttached.getString("dtjqQyqLre");
					String dtjhQyqLre = pricingAttached.getString("dtjhQyqLre");
					prepareXgEquityPrice(CoreWarnItemEnum.EQUITYBEFOREPROFIT.getKey(),project_id,flow_id,isJt,
							czlreqyq_czlrlpc_per,tzbQyqLre,zgb_qyq_lre,ncbQyqLre,dtjqQyqLre,dtjhQyqLre,detailList,groupVersionId);
					//权益后创造利润额
					String czlreqyh_czlrlpc_per = pricingAttached.getString("czlreqyh_czlrlpc_per");
					String tzbQyhLre = pricingAttached.getString("tzbQyhLre");
					String zgb_qyh_lre = pricingAttached.getString("zgb_qyh_lre");
					String ncbQyhLre = pricingAttached.getString("ncbQyhLre");
					String dtjqQyhLre = pricingAttached.getString("dtjqQyhLre");
					String dtjhQyhLre = pricingAttached.getString("dtjhQyhLre");
					prepareXgEquityPrice(CoreWarnItemEnum.EQUITYAFTERPROFIT.getKey(),project_id,flow_id,isJt,
							czlreqyh_czlrlpc_per,tzbQyhLre,zgb_qyh_lre,ncbQyhLre,dtjqQyhLre,dtjhQyhLre,detailList,groupVersionId);
					//创造利润率
					String czlrlzp_czlrlpc_per = pricingAttached.getString("czlrlzp_czlrlpc_per");
					String tzbLrl = pricingAttached.getString("tzbLrl");
					String zgb_lrl = pricingAttached.getString("zgb_lrl");
					String ncbLrl = pricingAttached.getString("ncbLrl");
					String dtjqLrl = pricingAttached.getString("dtjqLrl");
					String dtjhLrl = pricingAttached.getString("dtjhLrl");
					prepareXgEquityPrice(CoreWarnItemEnum.CREATEPROFIT.getKey(),project_id,flow_id,isJt,
							czlrlzp_czlrlpc_per,tzbLrl,zgb_lrl,ncbLrl,dtjqLrl,dtjhLrl,detailList,groupVersionId);
					
					//非融IRR
					String irr_czlrlpc_per = pricingAttached.getString("irr_czlrlpc_per");
					String tzbIrr = pricingAttached.getString("tzbIrr");
					String zgb_irr = pricingAttached.getString("zgb_irr");
					String ncbIrr = pricingAttached.getString("ncbIrr");
					String dtjqIrr = pricingAttached.getString("dtjqIrr");
					String dtjhIrr = pricingAttached.getString("dtjhIrr");
					prepareXgEquityPrice(CoreWarnItemEnum.MELTINGIRR.getKey(),project_id,flow_id,isJt,
							irr_czlrlpc_per,tzbIrr,zgb_irr,ncbIrr,dtjqIrr,dtjhIrr,detailList,groupVersionId);
					
					//非融静态投资回收期
					String jthsq_czlrlpc_per = pricingAttached.getString("jthsq_czlrlpc_per");
					String tzbHsq = pricingAttached.getString("tzbHsq");
					String zgb_hsq = pricingAttached.getString("zgb_hsq");
					String ncbHsq = pricingAttached.getString("ncbHsq");
					String dtjqHsq = pricingAttached.getString("dtjqHsq");
					String dtjhHsq = pricingAttached.getString("dtjhHsq");
					prepareXgEquityPrice(CoreWarnItemEnum.MELTINGINVESTMENT.getKey(),project_id,flow_id,isJt,
							jthsq_czlrlpc_per,tzbHsq,zgb_hsq,ncbHsq,dtjqHsq,dtjhHsq,detailList,groupVersionId);
					
					isGroup = isJt;
				}
			}
		}
		
		if(CollectionUtils.isNotEmpty(detailList)) {
			if(isGroup != null && isGroup.intValue() == 1) {
				priceCoreDetailMapper.updateByProjectId(projectId);
			}
			priceCoreDetailMapper.insertBatch(detailList);
		}
		
		return isGroup;
	}

	private void prepareXgEquityPrice(String type,String project_id, String flow_id, Integer isJt, 
			String profitChange,String investment,String strategy,String group,String before,String after,
			List<PriceCoreDetail> detailList,String groupVersionId) {
		PriceCoreDetail detail = new PriceCoreDetail();
		detail.setId(UUIDUtils.create());
		detail.setFlowId(flow_id);
		detail.setProjectId(project_id);
		detail.setVersionId(groupVersionId);
		detail.setType(type);
		detail.setProfitChange(NumberUtils.strToDecimal(profitChange));
		detail.setInvestment(NumberUtils.strToDecimal(investment));
		detail.setStrategy(NumberUtils.strToDecimal(strategy));
		detail.setGroup(NumberUtils.strToDecimal(group));
		detail.setBefore(NumberUtils.strToDecimal(before));
		detail.setAfter(NumberUtils.strToDecimal(after));
		detail.setIsGroup(isJt);
		detail.setSource("销售管理系统");
		detail.setIsDelete(IsDeleteEnum.NO.getKey());
		if(isJt != null && isJt.intValue() == 1) {
			detail.setIsNewst(1);
		}
		detail.setCreateBy(Constants.SYS);
		detail.setCreateTime(LocalDateTime.now());
		detail.setUpdateBy(null);
		detail.setUpdateTime(LocalDateTime.now());
		
		detailList.add(detail);
	}
	
	private void prepareGxcEquityPrice(String projectId,CoreWarnInfoVO vo,List<PriceCoreDetail> detailList,
			String groupVersionId,String flowId,Integer isPresident) {
		PriceCoreDetail detail = new PriceCoreDetail();
		detail.setId(UUIDUtils.create());
		detail.setFlowId(flowId);
		detail.setProjectId(projectId);
		detail.setVersionId(groupVersionId);
		detail.setType(vo.getType());
		detail.setProfitChange(null);
		detail.setInvestment(NumberUtils.strToDecimal(vo.getInvestment()));
		detail.setStrategy(NumberUtils.strToDecimal(vo.getStrategy()));
		detail.setGroup(NumberUtils.strToDecimal(vo.getPresident()));
		detail.setBefore(NumberUtils.strToDecimal(vo.getBefore()));
		detail.setAfter(NumberUtils.strToDecimal(vo.getAfter()));
		detail.setIsGroup(isPresident);
		detail.setSource("供销存系统");
		detail.setIsDelete(IsDeleteEnum.NO.getKey());
		if(isPresident != null && isPresident.intValue() == 1) {
			detail.setIsNewst(1);
		}
		detail.setCreateBy(Constants.SYS);
		detail.setCreateTime(LocalDateTime.now());
		detail.setUpdateBy(null);
		detail.setUpdateTime(LocalDateTime.now());
		detailList.add(detail);
	}

	private void preaprePriceVersionGroupDetail(String versionId, List<PriceValueOrg> priceDetails) {
		if(CollectionUtils.isNotEmpty(priceDetails)) {
			List<PriceValueOrgGroup> groupList = new ArrayList<>();
			long timesip = System.currentTimeMillis();
			for(PriceValueOrg org : priceDetails) {
				PriceValueOrgGroup group = new PriceValueOrgGroup();
				BeanUtils.copyProperties(org,group);
				if(!group.getType().equals(OrgTypeEunm.ORG_STAGE.getKey())) {
					group.setPid(group.getPid()+timesip);
				}
				group.setId(group.getId()+timesip);
				group.setVersionId(versionId);
				group.setCreateBy(Constants.SYS);
				group.setCreateTime(LocalDateTime.now());
				group.setUpdateBy(null);
				group.setUpdateTime(LocalDateTime.now());
				groupList.add(group);
			}
			priceValueOrgGroupMapper.insertBatch(groupList);
		}
	}

	private String preaprePriceVersionGroup(PriceVersion sourcePriceVersion,String groupVersionId,Integer isPresident,String flowId) {
		PriceVersionGroup priceVersionGroup = new PriceVersionGroup();
		BeanUtils.copyProperties(sourcePriceVersion,priceVersionGroup);
		PriceVersionGroup lastPriceVersionGroup = priceVersionGroupMapper.selectLastVersionByStageId(sourcePriceVersion.getProjectfId(),isPresident,IsDeleteEnum.NO.getKey());
		String versionId = UUIDUtils.create();
		String versionNum = "";
		
		priceVersionGroup.setId(versionId);
		priceVersionGroup.setSourcePriceVersionId(sourcePriceVersion.getId());
		priceVersionGroup.setSourcePriceVersionNum(sourcePriceVersion.getVersionNum());
		priceVersionGroup.setSourcePriceVersionName(VersionTypeEunm.getValueByKey(sourcePriceVersion.getVersionType()));
		priceVersionGroup.setBillId(flowId);
		if(lastPriceVersionGroup != null) {
			priceVersionGroup.setPreVersionId(lastPriceVersionGroup.getId());
			priceVersionGroup.setPreVersionNum(lastPriceVersionGroup.getVersionNum());
			versionNum =  VersionUtils.bigVersionInc(lastPriceVersionGroup.getVersionNum());
		}else {
			priceVersionGroup.setPreVersionId(null);
			priceVersionGroup.setPreVersionNum(null);
			versionNum = "V1";
		}
		priceVersionGroup.setVersionId(groupVersionId);
		if(isPresident != null && isPresident.intValue() == 1) {
			priceVersionGroup.setVersionName(VersionTypeEunm.GROUP.getValue());
			priceVersionGroup.setVersionType(VersionTypeEunm.GROUP.getKey());
		}else {
			priceVersionGroup.setVersionName(VersionTypeEunm.UN_GROUP.getValue());
			priceVersionGroup.setVersionType(VersionTypeEunm.UN_GROUP.getKey());
		}
		priceVersionGroup.setVersionNum(versionNum);
		priceVersionGroup.setVersionState(VersionStatusEnum.SYSGENERATION.getKey());
		priceVersionGroup.setVersionCreateState(VersionCreateEnum.AUTOMATICCREATE.getKey());
		priceVersionGroup.setRemake("生成货值审批版版本");
		priceVersionGroup.setIsPresident(isPresident);
		priceVersionGroup.setCreateBy(Constants.SYS);
		priceVersionGroup.setCreateTime(LocalDateTime.now());
		priceVersionGroup.setUpdateBy(null);
		priceVersionGroup.setUpdateTime(LocalDateTime.now());
		
		priceVersionGroupMapper.insert(priceVersionGroup);
		return versionId;
		
	}

	private String queryCoreIndicators(String tjPlanGUID) {
		EsbXgReqParam param = EsbXgReqParam(tjPlanGUID);
		BasicAuthClient bac = new BasicAuthClient();
		String result =  bac.post(xgQueryUrl, JSON.toJSONString(param),apiName,apiKey);
		log.info("##### 查询销管货值审批核心指标数据接口 参数："+ JSON.toJSONString(param));
		log.info("##### 查询销管货值审批核心指标数据接口 响应数据："+ result);
		SysLogBO bo = new SysLogBO();
   		bo.setEvent(LogEventEnum.ESB);
       	bo.setSource(LogSrcEnum.PC);
       	bo.setIp(WebUtils.getLocalIP());
       	bo.setModule("ESB数据接收");
       	bo.setTitle("销管货值审批核心指标数据");
       	bo.setContent(result);
       	bo.setType(LogTypeEnum.ONE.getKey());
       	bo.setIsSuccess(IsSuccessEnum.SUCCESS.getKey());
       	sysLogService.add(bo,"sys");
		return result;
	}
	
	private EsbXgReqParam EsbXgReqParam(String tjPlanGUID) {
		EsbXgReqParam param = new EsbXgReqParam();
		JSONObject data = new JSONObject();
		data.put("TjPlanGUID", tjPlanGUID);
		param.setRequestInfo(data);
		JSONObject requestInfo = new JSONObject();
		requestInfo.put("data", data);
		param.setRequestInfo(requestInfo);
		
		EsbInfoReq esbInfo = new EsbInfoReq();
		esbInfo.setAttr1("null");
		esbInfo.setAttr2("null");
		esbInfo.setAttr3("null");
		esbInfo.setInstId("");
		esbInfo.setRequestTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")));
		param.setEsbInfo(esbInfo);
		return param;
	}

	@Override
	public PriceCoreValueBO queryPriceValue(String projectId) {
		PriceCoreValueBO bo = new PriceCoreValueBO();
		List<PriceCoreDetailDTO> detailList = priceCoreDetailMapper.selectNewstByProjectId(projectId);
		if(CollectionUtils.isNotEmpty(detailList)) {
			PriceCoreDataBO dataBo = new PriceCoreDataBO();
			CoreValueBO equityPrice = getPriceCoreDetail(CoreWarnItemEnum.EQUITYPRICE.getKey(),detailList);
			CoreValueBO equityBeforeProfit = getPriceCoreDetail(CoreWarnItemEnum.EQUITYBEFOREPROFIT.getKey(),detailList);
			CoreValueBO equityAfterProfit = getPriceCoreDetail(CoreWarnItemEnum.EQUITYAFTERPROFIT.getKey(),detailList);
			CoreValueBO createProfit = getPriceCoreDetail(CoreWarnItemEnum.CREATEPROFIT.getKey(),detailList);
			CoreValueBO meltingIRR = getPriceCoreDetail(CoreWarnItemEnum.MELTINGIRR.getKey(),detailList);
			CoreValueBO meltingInvestment = getPriceCoreDetail(CoreWarnItemEnum.MELTINGINVESTMENT.getKey(),detailList);
			dataBo.setEquityPrice(equityPrice);
			dataBo.setEquityBeforeProfit(equityBeforeProfit);
			dataBo.setEquityAfterProfit(equityAfterProfit);
			dataBo.setCreateProfit(createProfit);
			dataBo.setMeltingIRR(meltingIRR);
			dataBo.setMeltingInvestment(meltingInvestment);
			
			bo.setFlowId(detailList.get(0).getFlowId());
			bo.setProjectId(projectId);
			bo.setProjectName(detailList.get(0).getProjectName());
			bo.setBusinessUnitId(detailList.get(0).getBusinessUnitId());
			bo.setBusinessUnitName(detailList.get(0).getBusinessUnitName());
			bo.setCityId(detailList.get(0).getCityId());
			bo.setCityName(detailList.get(0).getCityName());
			bo.setIsGroup(detailList.get(0).getIsGroup() == null ? "" : detailList.get(0).getIsGroup()+"");
			bo.setCoreData(dataBo);
		}
		
		return bo;
	}

	private CoreValueBO getPriceCoreDetail(String type, List<PriceCoreDetailDTO> detailList) {
		for(PriceCoreDetailDTO detail : detailList) {
			if(type.equals(detail.getType())) {
				CoreValueBO bo = new CoreValueBO();
				bo.setProfitChange(NumberUtils.decimalToStr(detail.getProfitChange()));
				bo.setInvestment(NumberUtils.decimalToStr(detail.getInvestment()));
				bo.setStrategy(NumberUtils.decimalToStr(detail.getStrategy()));
				bo.setGroup(NumberUtils.decimalToStr(detail.getGroup()));
				bo.setBefore(NumberUtils.decimalToStr(detail.getBefore()));
				bo.setAfter(NumberUtils.decimalToStr(detail.getAfter()));
				return bo;
			}
		}
		return null;
	}

	@Override
	public void saveGroupRefreshRecord(String projectId, String schemeId) {
		priceCoreDetailMapper.saveGroupRefreshRecord(projectId,schemeId,WhetherEnum.NO.getKey());
	}
	
	

}
